<?php 
declare (strict_types = 1);
namespace app\api\controller;
use app\common\controller\Api;
use think\Request;
class Msg extends Api
{
    //门店消息列表
    public function bus_index()
    {
        $this->businessCheckLogin();
        $post = param();
        $this->where[] = ['type','=',2];
        $this->where[] = ['business_id','=',$this->businessinfo['id']];
        $this->order = $post['order'] ?? 'id desc';
        $this->limit = $post['limit'] ?? $this->limit;
        $this->field = $post['field'] ?? $this->field;
        $data = $this->model->where($this->where)->order($this->order)->with($this->with)->field($this->field)->paginate($this->limit)->toArray();
        return datasuccess($data);
    }
    //用户消息列表
    public function index()
    {
        $this->checkLogin();
        $post = param();
        $this->where[] = ['type','=',1];
        $this->where[] = ['user_index_id','=',$this->userinfo['id']];
        $this->order = $post['order'] ?? 'id desc';
        $this->limit = $post['limit'] ?? $this->limit;
        $this->field = $post['field'] ?? $this->field;
        $data = $this->model->where($this->where)->order($this->order)->with($this->with)->field($this->field)->paginate($this->limit)->toArray();
        return datasuccess($data);
    }
}